import wepy from 'wepy';
import api from '@/api/api';

export default class GetCardcase extends wepy.mixin {
  data = {
    cardcase1: [],
    cardcase2: []
  }

  //TODO:获取名片夹列表,未来使用缓存处理数据
  async getCardcase(type = 1) {
    type = +type;

    this.sortType = type;

    let rlt = await api.findCollect({
      query: { type: type, keyword: '' }
    });

    console.log(rlt);

    if (+rlt.data.code === 12000) {
      if (type === 1) {
        this.cardcase1 = rlt.data.data;
      } else {
        this.cardcase2 = rlt.data.data;
      }
    }

    this.$apply();
  }
}